.class Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;
.super Landroid/os/AsyncTask;
.source "BaseImageDownloader.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/netease/newsreader/util/BaseImageDownloader;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = "BitmapDownloaderTask"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask",
        "<",
        "Ljava/lang/String;",
        "Ljava/lang/Void;",
        "Landroid/graphics/Bitmap;",
        ">;"
    }
.end annotation


# instance fields
.field private httpGet:Lorg/apache/http/client/methods/HttpGet;

.field private final imageViewReference:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference",
            "<",
            "Landroid/widget/ImageView;",
            ">;"
        }
    .end annotation
.end field

.field final synthetic this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>(Lcom/netease/newsreader/util/BaseImageDownloader;Landroid/widget/ImageView;)V
    .locals 1
    .parameter
    .parameter "imageView"

    .prologue
    .line 538
    iput-object p1, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    .line 536
    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    .line 535
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->httpGet:Lorg/apache/http/client/methods/HttpGet;

    .line 537
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p2}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->imageViewReference:Ljava/lang/ref/WeakReference;

    return-void
.end method

.method static synthetic access$2(Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 533
    iget-object v0, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->url:Ljava/lang/String;

    return-object v0
.end method


# virtual methods
.method protected varargs doInBackground([Ljava/lang/String;)Landroid/graphics/Bitmap;
    .locals 4
    .parameter "params"

    .prologue
    .line 556
    const/4 v1, 0x0

    :try_start_0
    aget-object v1, p1, v1

    iput-object v1, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->url:Ljava/lang/String;

    .line 557
    monitor-enter p0
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 558
    :try_start_1
    invoke-virtual {p0}, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->isCancelled()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 559
    iget-object v1, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {v1}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$1(Lcom/netease/newsreader/util/BaseImageDownloader;)Landroid/graphics/Bitmap;

    move-result-object v1

    monitor-exit p0

    .line 567
    :goto_0
    return-object v1

    .line 561
    :cond_0
    new-instance v1, Lorg/apache/http/client/methods/HttpGet;

    iget-object v2, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->url:Ljava/lang/String;

    invoke-direct {v1, v2}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V

    iput-object v1, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->httpGet:Lorg/apache/http/client/methods/HttpGet;

    .line 557
    monitor-exit p0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 563
    :try_start_2
    iget-object v1, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    iget-object v2, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->url:Ljava/lang/String;

    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->httpGet:Lorg/apache/http/client/methods/HttpGet;

    invoke-virtual {v1, v2, v3}, Lcom/netease/newsreader/util/BaseImageDownloader;->downloadBitmap(Ljava/lang/String;Lorg/apache/http/client/methods/HttpGet;)Landroid/graphics/Bitmap;
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    move-result-object v1

    goto :goto_0

    .line 557
    :catchall_0
    move-exception v1

    :try_start_3
    monitor-exit p0
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    :try_start_4
    throw v1
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_0

    .line 564
    :catch_0
    move-exception v0

    .line 566
    .local v0, e:Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 567
    iget-object v1, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {v1}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$1(Lcom/netease/newsreader/util/BaseImageDownloader;)Landroid/graphics/Bitmap;

    move-result-object v1

    goto :goto_0
.end method

.method protected bridge varargs synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .parameter

    .prologue
    .line 1
    check-cast p1, [Ljava/lang/String;

    invoke-virtual {p0, p1}, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->doInBackground([Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v0

    return-object v0
.end method

.method protected onCancelled()V
    .locals 1

    .prologue
    .line 542
    invoke-super {p0}, Landroid/os/AsyncTask;->onCancelled()V

    .line 543
    monitor-enter p0

    .line 544
    :try_start_0
    iget-object v0, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->httpGet:Lorg/apache/http/client/methods/HttpGet;

    if-eqz v0, :cond_0

    .line 545
    iget-object v0, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->httpGet:Lorg/apache/http/client/methods/HttpGet;

    invoke-virtual {v0}, Lorg/apache/http/client/methods/HttpGet;->abort()V

    .line 546
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->httpGet:Lorg/apache/http/client/methods/HttpGet;

    .line 543
    :cond_0
    monitor-exit p0

    .line 549
    return-void

    .line 543
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method protected onPostExecute(Landroid/graphics/Bitmap;)V
    .locals 5
    .parameter "bitmap"

    .prologue
    .line 578
    if-eqz p1, :cond_0

    .line 579
    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    iget-object v4, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->url:Ljava/lang/String;

    invoke-static {v3, v4, p1}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$2(Lcom/netease/newsreader/util/BaseImageDownloader;Ljava/lang/String;Landroid/graphics/Bitmap;)V

    .line 582
    :cond_0
    invoke-virtual {p0}, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->isCancelled()Z

    move-result v3

    if-eqz v3, :cond_2

    .line 583
    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {v3}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$1(Lcom/netease/newsreader/util/BaseImageDownloader;)Landroid/graphics/Bitmap;

    move-result-object p1

    .line 613
    :cond_1
    :goto_0
    return-void

    .line 585
    :cond_2
    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->imageViewReference:Ljava/lang/ref/WeakReference;

    if-eqz v3, :cond_1

    .line 586
    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->imageViewReference:Ljava/lang/ref/WeakReference;

    invoke-virtual {v3}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    .line 587
    .local v2, imageView:Landroid/widget/ImageView;
    if-eqz v2, :cond_1

    .line 588
    invoke-static {v2}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$3(Landroid/widget/ImageView;)Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;

    move-result-object v0

    .line 592
    .local v0, bitmapDownloaderTask:Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;
    if-eqz v0, :cond_1

    if-ne p0, v0, :cond_1

    .line 593
    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {v3}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$4(Lcom/netease/newsreader/util/BaseImageDownloader;)Ljava/lang/Thread;

    move-result-object v3

    if-eqz v3, :cond_1

    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {v3}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$4(Lcom/netease/newsreader/util/BaseImageDownloader;)Ljava/lang/Thread;

    move-result-object v3

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v4

    if-ne v3, v4, :cond_1

    .line 595
    if-eqz p1, :cond_3

    .line 596
    :try_start_0
    invoke-virtual {v2, p1}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 604
    :catch_0
    move-exception v1

    .line 606
    .local v1, e:Ljava/lang/Exception;
    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0

    .line 598
    .end local v1           #e:Ljava/lang/Exception;
    :cond_3
    :try_start_1
    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {v3}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$1(Lcom/netease/newsreader/util/BaseImageDownloader;)Landroid/graphics/Bitmap;

    move-result-object v3

    if-eqz v3, :cond_1

    .line 599
    iget-object v3, p0, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->this$0:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {v3}, Lcom/netease/newsreader/util/BaseImageDownloader;->access$1(Lcom/netease/newsreader/util/BaseImageDownloader;)Landroid/graphics/Bitmap;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0
.end method

.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
    .locals 0
    .parameter

    .prologue
    .line 1
    check-cast p1, Landroid/graphics/Bitmap;

    invoke-virtual {p0, p1}, Lcom/netease/newsreader/util/BaseImageDownloader$BitmapDownloaderTask;->onPostExecute(Landroid/graphics/Bitmap;)V

    return-void
.end method
